<?php


/** ensure this file is being included by a parent file */
defined('_JEXEC') or die('Restricted access');

		echo "<form action='{$this->formAction}' method='post' name='adminForm' id='adminForm' enctype='multipart/form-data'>";
		?>
		<table class="adminheading">
		<tr>
			<th class='helpdesk_categories'>
				<?php echo isset($this->pagetitle) ? $this->pagetitle : '' ?>
			</th>
		</tr>
		</table>

		<div id='onBeforeDisplay_wrapper'>
			<?php 
				$dispatcher = HelpDeskHelperPlugin::getInstance();
				$dispatcher->trigger( 'onBeforeDisplayCategoryForm', array( $this->row, $this->user ) );
			?>
		</div>                

		<table class="invisible">
			<tbody>
                <tr>
					<td valign="top">

					<?php
					// display defaults
					$pane = '1';
					echo $this->sliders->startPane( "pane_$pane" );
					
					$legend = HelpDeskText::_( "Default Information" );
					echo $this->sliders->startPanel( HelpDeskText::_( $legend ), 'defaults' );
									
						echo '<table class="userlist">';
						echo '<tr>';
			            	echo '<td class="title">';
								echo HelpDeskText::_( 'Title' ).' '.$this->required->image;
							echo '</td>';
			                echo '<td class="input">';
								echo "<input name='title' type='text' class='text_area' size='50' value='{$this->row->title}' />";
			                echo '</td>';
						echo '</tr>';
			
						echo '<tr>';
			            	echo '<td class="title">';
								echo HelpDeskText::_( 'Description' );
							echo '</td>';
			                echo '<td class="input">';
			                // TODO Use Editor?
			                	echo "<textarea name='description' cols='40' rows='10' style='width:500px' width='500px' >".stripslashes($this->row->description)."</textarea>";
			                echo '</td>';
						echo '</tr>';
						
						echo '<tr>';
			            	echo '<td class="title">';
								echo HelpDeskText::_( 'Published' );
							echo '</td>';
			                echo '<td class="input">';
								echo $this->select_published;
			                echo '</td>';
						echo '</tr>';
												
						echo '<tr>';
			            	echo '<td class="title">';
								echo HelpDeskText::_( 'Parent' );
							echo '</td>';
			                echo '<td class="input">';
								echo $this->select_parentid;
			                echo '</td>';
						echo '</tr>';
												
						echo '</table>';
						
					echo $this->sliders->endPanel();
						
					// if there are plugins, display them accordingly
	                if ($this->items_sliders) 
	                {               	
                		$tab=1;
						$pane=2;
						for ($i=0, $count=count($this->items_sliders); $i < $count; $i++) {
							if ($pane == 1) {
								// echo $this->sliders->startPane( "pane_$pane" );
							}
							$item = $this->items_sliders[$i];
							echo $this->sliders->startPanel( HelpDeskText::_( $item->element ), $item->element );
							
							// load the plugin
								$import = HelpDeskHelperPlugin::importPlugin( strtolower( 'HelpDesk' ), $item->element );
							// fire plugin
								$dispatcher = HelpDeskHelperPlugin::getInstance();
								$dispatcher->trigger( 'onDisplayCategoryFormSliders', array( $item, $this->row ) );
								
							echo $this->sliders->endPanel();
							if ($i == $count-1) {
								// echo $this->sliders->endPane();
							}
						}
					}
					
					echo $this->sliders->endPane();
					
					?>
					</td>
					<td valign="top">
					
						<div id='onDisplayRightColumn_wrapper'>
							<?php
								$dispatcher = HelpDeskHelperPlugin::getInstance();
								$dispatcher->trigger( 'onDisplayCategoryFormRightColumn', array( $this->row, $this->user ) );
							?>
						</div>

					</td>
                </tr>
            </tbody>
		</table>

		<div id='onAfterDisplay_wrapper'>
			<?php 
				$dispatcher =& HelpDeskHelperPlugin::getInstance();
				$dispatcher->trigger( 'onAfterDisplayCategoryForm', array( $this->row, $this->user ) );
			?>
		</div>
		
		<p>* <?php echo HelpDeskText::_( "or" )  . " " . $this->required->image . " " . HelpDeskText::_( 'Required Field' ); ?></p>

		<input type="hidden" name="option" value="<?php echo $this->formOption; ?>" />
		<input type="hidden" name="controller" value="<?php echo $this->formController; ?>" />
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="id" value="<?php echo $this->formId; ?>" />
		<input type="hidden" name="boxchecked" value="" />
		<input type="hidden" name="order" value="<?php echo @$this->order; ?>" />
		<input type="hidden" name="order_dir" value="<?php echo @$this->order_dir; ?>" />
        
		<?php
		echo $this->formValidate;
		echo "</form>";
		?>